package com.htu.lichen.controller;

import com.htu.lichen.exception.ProductException;
import com.htu.lichen.utils.Result;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lichen
 * @Date: 12/29/20 12:38 PM
 */

@RestController
@RequestMapping("/test")
public class TestController {

    @RequestMapping(value = "/testException/{id}",method = RequestMethod.GET)
    public Result<Object> testException(@PathVariable Integer id){
        if (id == 1){
            return new Result<>();
        }else {
            throw new ProductException("发生了异常！");
        }
    }


}
